export type FizzBuzzType = number | string;


const fizzBuzzConverter = (number: number): FizzBuzzType => {
    if (number < 1 || number > 100) {
        throw new RangeError('不在给定的字符范围内')
    }
    if (number.toString().indexOf('3') > -1) {
        return 'Fizz'
    }
    if (number % 15 === 0) {
        return 'FizzBuzz'
    } else if (number % 3 === 0) {
        return 'Fizz'
    } else if (number % 5 === 0 ) {
        return 'Buzz'
    }
    return number.toString();
}

export default fizzBuzzConverter;